const constans = require('../../constans/constans.js');
const request = require('../../request.js');
const Toast = require('../../utils/Toast.js');
const LogUtils = require('../../utils/LogUtils.js');
const util = require('../../utils/util.js')
const app = getApp();

Page({
  data: {
    logs: [],
    height1: '',
    data: {},
    data_moey: [],
  },
  onLoad: function () {
    app.requestHeader = { 'Authorization': wx.getStorageSync('Authorization') }

    let that = this;
    // 获取系统信息
    wx.getSystemInfo({
      success: function (res) {
        // 获取可使用窗口宽度
        let clientHeight = res.windowHeight;
        // 获取可使用窗口高度
        let clientWidth = res.windowWidth;
        // 算出比例
        let ratio = 750 / clientWidth;
        // 算出高度(单位rpx)
        let height = clientHeight * ratio;
        // 设置高度
        that.setData({
          height1: height
        });
      }
    });
    var arr = [];
    request.get(
      constans.getCashRecord,
      {},
      function (data) {

        that.setData({
          data: data.data.data
        });
        for (var i = 0, len = that.data.data.length; i < len; i++) {

          console.log(that.data.data[i].amount / 100)
          arr.push((that.data.data[i].amount / 100).toFixed(2))
        }
        that.setData({
          data_moey: arr
        });
        console.log(that.data.data_moey)
        console.log(data)
      })
  },

})